<?php
namespace app\common\validate;

use think\Validate;

class TemplateValidate extends Validate
{
    protected $rule =   [
        'title'  => 'require|max:50',
        'image'  => 'require',
        'type'  => 'require',
		'describe' => 'require|max:1000',
		'sort'	=> 'require|number'
    ];
    
    protected $message  =   [
        'title.require' 	=> '标题必须填写',
        'title.max'     	=> '标题最多不能超过50个字符',
        'image.require'     => '缩略图必须上传',
        'type.require'     => '类型必须选择',
		'describe.require'	=> '图片必须填写',
		'sort.number' 		=> '必须输入数字',
    ];
    
    protected $scene = [
        'add'  	=>  ['title','describe','sort','image','type'],
        'edit'  => ['title','describe','sort','image'],
		'sort' 	=> ['sort'],
		'title' => ['title']
    ];
}
